limsSample.rateListPage = {

    getGridParam: function() {
        var _this = this;
        return {
            type: 'grid',
            id: 'lims-sample-pass-rate-grid',
            page: true,
            pageList: [50, 100, 200],
            filterOpen: true,
            columns: limsSample.getPassRateColumns(),
            onLoadSuccess: function (rows) {
                if(Gikam.isNotEmpty(rows)) {
                    Gikam.getComp('pass-rate-form').setData(rows[0]);
                }else {
                    Gikam.getComp('pass-rate-form').cleanData();
                }
            },
            onRowActive: function (index, row) {},
            toolbar: [{
                type: 'form',
                id:'pass-rate-form',
                readonly:true,
                fields:[{
                    field: 'ext$.allnum',
                    title: '本月到样总数',
                    refreshGrid : false,
                    inputWidth : 80
                },{
                    field: 'ext$.unqualifiednum',
                    title: '不合格数',
                    refreshGrid : false,
                    inputWidth : 80
                },{
                    field: 'ext$.rate',
                    title: '合格率',
                    refreshGrid : false,
                    inputWidth : 80
                }]
            },{
                type : 'form',
                id : 'pass-search-form',
                fields : [{
                    field : 'startTime',
                    title : '开始时间',
                    type : 'dateTime',
                    refreshGrid : false,
                    inputWidth : 180
                },{
                    field : 'endTime',
                    title : '结束时间',
                    type : 'dateTime',
                    refreshGrid : false,
                    inputWidth : 180
                }]
            },{
                type : 'button',
                text : '查询',
                icon : 'search',
                onClick : function () {
                    let form = Gikam.getComp('pass-search-form');
                    let grid = Gikam.getComp('lims-sample-pass-rate-grid');
                    let data = form.getData();
                    if (Gikam.isEmpty(data.startTime) && Gikam.isEmpty(data.endTime)) {
                        Gikam.alert('请先填写查询条件！');
                        return;
                    }
                    let reqParam = {};
                    if (Gikam.isNotEmpty(data.startTime)) {
                        reqParam.instoretime_TGOE = Gikam.DateUtils.formatter(new Date(data.startTime), 'yyyy-MM-dd hh:mm:ss');
                    }
                    if (Gikam.isNotEmpty(data.endTime)) {
                        reqParam.instoretime_TL = Gikam.DateUtils.formatter(new Date(data.endTime), 'yyyy-MM-dd hh:mm:ss');
                    }
                    grid.cleanRequestData();
                    grid.refresh({
                        url: limsSample.baseUrl + '/selectPassRate',
                        requestData: reqParam
                    });
                }
            }]
        }
    },

    create: function () {
        var _this = this;
        Gikam.create('layout', {
            id: 'lims-sample-pass-rate-list-layout',
            renderTo: workspace.window.$dom,
            center: {
                items: [this.getGridParam()]
            }
        });
    },

    init: function () {
        this.create();
    }
};